set(LUA_VERSION "5.4.4")
set(LUA_SRC_PATH ${CMAKE_CURRENT_LIST_DIR})

set(lib_name plainlua)
set(target_name ${lib_name})

include(Platform)

project(${lib_name})

set(LUA_CORE ${LUA_SRC_PATH}/onelua.c)

add_library(${target_name} ${LUA_CORE})
if(WINDOWS)
    target_compile_definitions(${target_name} PUBLIC MAKE_LIB)
elseif(LINUX)
    target_compile_definitions(${target_name}
        PUBLIC LUA_USE_LINUX 
        PUBLIC MAKE_LIB
    )
endif(WINDOWS)

set_target_properties(${target_name}
    PROPERTIES
    ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
    FOLDER "External"
)